<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>Hot Account Report</title>
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">

    <link rel="stylesheet" href="../../../../css/mui.min.css">
    <link rel="stylesheet" href="../../../../css/global.css">
    <link rel="stylesheet" href="../../../../css/style.css">
    <link href="../../../../css/task.css" rel="stylesheet" />

    <style>
        .page_cen {
            overflow: hidden;
        }

        .details_con .clum {
            font-size: 16px;
            margin: 0 5px;
            display: flex;
            align-items: center;
            min-height: 50px;
            height: auto;
        }

        .details_con .clum .txt {
            flex: 1;
            text-align: right;
            line-height: 1.2;
            padding: 10px;
        }

        .title {
            font-size: 16px;
            padding: 15px 5px 10px;
            border-bottom: 1px solid #e8e8e8;
        }

        .item_box .item {
            margin: 0 0 15px;
        }

        .item_box .item .text span {
            width: 90px;
        }
        #div {
            width: 0px;
            height: 0px;
            background: red;
            position: fixed;
            top: 65%;
            left: 50%;
        }
        /*移除底部或顶部三角,需要在删除此代码*/
        .mui-popover .mui-popover-arrow:after {
            width: 0px;
        }
        .mui-popover .title{
            border-bottom: none;
        }
    </style>
</head>

<body>
<header class="mui-bar mui-bar-nav">
    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
    <h1 id="title" class="mui-title">Hot Account Report</h1>
</header>
<div class="mui-content" v-cloak>
    <div id="div"></div>
    <div id="popover" class="mui-popover shadow popover">
        <p class="title" id="title">是否确认关闭该报告？</p>
        <div class="btn_box">
            <span class="fl" @click="confirmCancel">否</span>
            <span class="fr red" @click="errorClose">是</span>
        </div>
    </div>
    <div v-if="reportData">
        <div class="page_cen shadow">
            <div class="details_con">
                <div class="clum">
                    <span class="name">公司名称</span>
                    <span class="txt">{{reportData.company_name1}}</span>
                </div>
                <div class="clum">
                    <span class="name">Company Name</span>
                    <span class="txt">{{reportData.company_name}}</span>
                </div>
                <div class="clum">
                    <span class="name">Equipment Model</span>
                    <span class="txt">{{reportData.equipment_model}}</span>
                </div>
                <div class="clum">
                    <span class="name">Service No</span>
                    <span class="txt">{{reportData.service_no}}</span>
                </div>

                <div class="clum">
                    <span class="name">Primary Contact</span>
                    <span class="txt">{{reportData.primary_contact}}</span>
                </div>
                <div class="clum">
                    <span class="name">Tel</span>
                    <span class="txt">{{reportData.tel}}</span>
                </div>
                <div class="clum">
                    <span class="name">E-mail address</span>
                    <span class="txt">{{reportData.email}}</span>
                </div>
                <div class="clum">
                    <span class="name">Factory PO#</span>
                    <span class="txt">{{reportData.order_no}}</span>
                </div>
                <div class="clum">
                    <span class="name">Factory Origin</span>
                    <span class="txt">{{reportData.factory_origin}}</span>
                </div>

                <div class="clum">
                    <span class="name">Engineer</span>
                    <span class="txt">{{reportData.engineer}}</span>
                </div>
                <div class="clum">
                    <span class="name">Installation Date</span>
                    <span class="txt">{{reportData.install_date}}</span>
                </div>
                <div class="clum">
                    <span class="name">Sales</span>
                    <span class="txt">{{reportData.sales}}</span>
                </div>
                <div class="clum">
                    <span class="name">Hot Account Type</span>
                    <span class="txt">{{reportData.hot_account_type}}</span>
                </div>
                <div class="clum">
                    <span class="name">Fail Type</span>
                    <span class="txt">{{reportData.fail_type}}</span>

                </div>
                <div class="clum">
                    <span class="name">Severity Level</span>
                    <span class="txt">{{reportData.Severity}}</span>

                </div>
                <div class="clum">
                    <span class="name">Instrument Return</span>
                    <span class="txt">{{reportData.InstrumentReturn}}</span>
                </div>
                <div class="clum">
                    <span class="name">Date1</span>
                    <span class="txt">{{reportData.date1}}</span>
                </div>
                <div class="clum">
                    <span class="name">Date2</span>
                    <span class="txt">{{reportData.date2}}</span>
                </div>
                <div class="clum">
                    <span class="name">Instrument Status</span>
                    <span class="txt">{{reportData.instrunment_status}}</span>
                </div>
                <div class="clum">
                    <span class="name">状态</span>
                    <span class="txt">{{reportData.HT_Status}}</span>
                </div>
                <div class="clum">
                    <span class="name">审批人</span>
                    <span class="txt">{{reportData.HT_Leader}}</span>
                </div>
                <div class="clum">
                    <span class="name">Problem</span>
                    <span class="txt">{{reportData.problem}}</span>
                </div>
                <div class="clum  nobor autoHeight">
                    <span class="name">Work done(incldue Date)</span>
                    <span class="txt">{{reportData.work_done}}</span>
                </div>
            </div>
        </div>
        <div class="page_cen shadow" v-if="partData.length">
            <div class="my-content-cell" @click="jumpToSparePartsList">
                <div class="inline-block">
                    <em>备件信息</em>
                    <span class="mui-icon mui-icon-arrowright arrow-right-position"></span>
                </div>
            </div>
        </div>
        <div class="page_cen shadow" v-if="reportData">
            <div class="details_con">
                <div class="clum">
                    <span class="name">Equipment Model</span>
                    <span class="txt">{{reportData.equipment_mode}}</span>
                </div>
                <div class="clum">
                    <span class="name">Service No</span>
                    <span class="txt">{{reportData.serial_no1}}</span>
                </div>
            </div>
        </div>

        <!-- <div class="page_cen shadow" v-if="partData.length">
            <p class="bg_title">备件信息</p>
            <div class="details_con">
                <div class="item_box" id="itemBox">
                    <div class="item" v-for="item in partData">
                        <p class="bar">备件编码：<span>{{item.Part_no}}</span></p>
                        <div class="text">{{item.Part_name}}<span>备件名称：</span></div>
                        <div class="text">{{item.Parts_Type}}<span>备件类型：</span></div>
                        <div class="text">{{item.qty}}<span>数量：</span></div>
                    </div>
                    <div style="clear: both"></div>
                </div>
            </div>
        </div> -->
        <div class="btn_box">
            <span @click="confirmClose" class="red" style="display: block; margin: 0 auto"
                  v-if="reportData.HT_Status === '跟踪中'">HT 报告关闭</span>
        </div>
        <div style="height: 50px;"></div>
    </div>
    <!-- 	<div v-else class="nodata">—— 暂无数据 ——</div> -->
</div>

<!-- js代码 start -->

<!-- 基础js start -->
<script src="../../../../js/mui.min.js"></script>
<script src="../../../../js/utils/h.js"></script>
<script src="../../../../js/constant.js"></script>
<script src="../../../../js/common.js"></script>
<script src="../../../../js/utils/base64.js"></script>
<script src="../../../../js/utils/md5.js"></script>
<script src="../../../../js/utils/sortMap.js"></script>
<script src="../../../../js/utils/http.js"></script>
<script src="../../../../js/utils/vue.min.js"></script>
<script src="../../../../js/app.js"></script>
<!-- 基础js end -->

<script type="text/javascript" charset="utf-8">
    var vm = null;
    var helpId;
    (function ($, doc) {
        $.init();

        $.plusReady(function () {
            var self = plus.webview.currentWebview();

            ajaxGet(BASE_URL + "cc/hot/account/report/detailHoatAccountReport", {
                id: self.hotId
            }, function (data) {
                app.closeWaiting()
                if (data.code === 200) {
                    helpId = data.data.helpId
                }
            }, function (errorMsg) {
                app.closeWaiting()
            });

            //备件列表
            vm = new Vue({
                el: '.mui-content',
                data: function () {
                    return {
                        reportData: null,
                        partData: []
                    }
                },
                mounted: function () {
                    console.log(app.getUser().enginnerId)
                    app.showWaiting('加载中...')
                    this.dataInit()
                },
                computed: {},
                methods: {
                    dataInit() {
                        var _this = this
                        ajaxGet(BASE_URL + "cc/hot/account/report/getCCHotReport", {
                            serviceNo: self.serviceNo,
                            enginnerId: app.getUser().enginnerId,
                            reportNo: self.reportNo
                        }, function (data) {
                            app.closeWaiting()
                            if (data.code === 200) {
                                if (!data.data.record.length) {
                                    app.toast(data.message)
                                    return
                                }
                                _this.reportData = data.data.record[0]
                                _this.partData = data.data.record[0].Part_data
                                // _this.data.reportData = data.data.record[0]
                                console.log(_this)
                            } else {
                                app.toast(data.msg)
                            }
                        }, function (errorMsg) {
                            app.closeWaiting()
                            app.toast(errorMsg)
                        });
                    },
                    resetData: function () {//重置数据
                        Object.assign(this.$data, getDefaultData());
                    },
                    jumpToSparePartsList: function () {
                        app.jumpTo('/view/service/report/errorhot/sparePartsList.html', 'view/service/report/errorhot/sparePartsList.html', {
                            serviceNo: self.serviceNo,
                            helpId: helpId,
                            portType: 4,
                            submitStatus: 1
                        })
                    },
                    confirmClose: function () {
                        mui("#popover").popover('show', document.getElementById("div"));
                    },
                    confirmCancel:function(){
                        mui("#popover").popover('hide', document.getElementById("div"));
                    },
                    errorClose: function () {
                        var _this = this
                        mui("#popover").popover('hide', document.getElementById("div"));
                        // 点击确认
                        app.showWaiting()
                        ajaxGet(BASE_URL + 'cc/notice/errorReportCloseNotice', {
                            serviceNo: self.serviceNo,
                            enginnerId: app.getUser().enginnerId,
                            reportGuid: self.reportNo,
                            reportType: 'HT'
                        }, function (data) {
                            if (data.code === 200) {
                                app.closeWaiting()
                                if (data.data.code == 200) {
                                    app.toast(data.data.msg)
                                    _this.dataInit()
                                } else {
                                    app.toast(data.data.data.message)
                                }
                            } else {
                                app.closeWaiting()
                                app.toast(data.msg)
                            }
                        }, function (err) {
                            app.closeWaiting()
                            app.toast(err)
                        })
                    }

                }
            });
        });
    }(mui, document));
</script>
<!-- js代码 end -->

</body>

</html>
